﻿<%@ Page Title="Average Player Ratings" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AveragePlayerRatings.aspx.vb" Inherits="WSAD_Assignment.AveragePlayerRatings" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .auto-style1 {
            font-size: large;
            font-weight: bold;
        }

        .noratingpng {
            background-image: url('../Images/norating.png');
            width: 32px;
            height: 32px;
        }

        .ratingpng {
            background-image: url('../Images/rating.png');
            width: 32px;
            height: 32px;
        }

        .doneratingpng {
            background-image: url('../Images/rating.png');
            width: 32px;
            height: 32px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <h3 class="form-signup-heading">Average Player Ratings</h3>

    <asp:UpdatePanel id="upAverageClubRatings" runat="server">
        <ContentTemplate>
            <asp:GridView ID="gvPlayerRatings" runat="server" AutoGenerateColumns="False" DataSourceID="PlayerRatingsDataSource"
                CssClass="table table-hover table-striped table-bordered table-condensed" AllowSorting="True" >
                <Columns>
                    <asp:HyperLinkField DataNavigateUrlFields="PlayerID" DataNavigateUrlFormatString="PlayerDetail.aspx?PlayerID={0}" DataTextField="FullName" HeaderText="Full Name" SortExpression="FullName" />
                    <asp:BoundField DataField="AverageRating" HeaderText="Average Rating" ReadOnly="True" SortExpression="AverageRating" DataFormatString="{0:0.##}" />
                    <asp:TemplateField runat="server">
                        <ItemTemplate>
                                <asp:Rating ID="AveragePlayerRating" runat="server" EmptyStarCssClass="noratingpng" FilledStarCssClass="ratingpng" StarCssClass="ratingpng" WaitingStarCssClass="doneratingpng" 
                                    CurrentRating='<%#Eval("AverageRating", "{0:0.##}")%>' ReadOnly="true">
                                </asp:Rating><br /><br />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="PlayerRatingsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ClubsConnectionString %>" ProviderName="<%$ ConnectionStrings:ClubsConnectionString.ProviderName %>" SelectCommand="SELECT [PlayerID], [FullName], [AverageRating] FROM [AveragePlayerRatings]"></asp:SqlDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
